package com.martin.study;

import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class ApplicationListenerDemo {
	public static void main(String[] args) {
		AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ApplicationListenerDemo.class);
		context.publishEvent("hello");
	}

	@Bean
	public ApplicationListener applicationListener() {
		return event -> System.out.println("Default ApplicationListener triggered...");
	}
}
